package com.bjsxt.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bjsxt.dubbo.DetailsDubboService;
import com.bjsxt.mapper.TbItemCatMapper;
import com.bjsxt.mapper.TbItemDescMapper;
import com.bjsxt.mapper.TbItemMapper;
import com.bjsxt.pojo.TbItem;
import com.bjsxt.pojo.TbItemCat;
import com.bjsxt.pojo.TbItemDesc;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author coder_z
 * @date 2023/3/19
 **/
@DubboService
public class DetailsDubboServiceImpl implements DetailsDubboService {
    @Autowired
    private TbItemMapper tbItemMapper;
    @Autowired
    private TbItemDescMapper tbItemDescMapper;
    @Autowired
    private TbItemCatMapper tbItemCatMapper;
    @Override
    public List<TbItem> selectByPage(int pageNumber, int pageSize) {
        Page<TbItem> page = new Page<>(pageNumber,pageSize);
        return tbItemMapper.selectPage(page,null).getRecords();
    }
    @Override
    public TbItemDesc selectDescById(long id) {
        return tbItemDescMapper.selectById(id);
    }

    @Override
    public TbItemCat selectCatById(long id) {
        return tbItemCatMapper.selectById(id);
    }

    @Override
    public Integer selectItemCount() {
        return tbItemMapper.selectCount(null);
    }
}
